package com.heiye.user.api.api;

import com.heiye.user.api.constants.ApiConstants;
import com.heiye.framework.common.response.Response;
import com.heiye.user.api.dto.req.FindUserByIdReqDTO;
import com.heiye.user.api.dto.req.FindUsersByIdsReqDTO;
import com.heiye.user.api.dto.req.RegisterUserReqDTO;
import com.heiye.user.api.dto.resp.FindUserByIdRspDTO;
import com.heiye.user.api.dto.resp.RegisterUserRspDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author: heiye
 * @date: 2024/09/29 上午11:22
 * @version: v1.0.0
 * @description: 用户feign调用类
 */
@FeignClient(name = ApiConstants.USER_NAME)
public interface UserFeignApi {

    String PREFIX = "/user";

    /**
     * 用户注册
     *
     * @param registerUserReqDTO
     * @return
     */
    @PostMapping(value = PREFIX + "/register")
    Response<RegisterUserRspDTO> userRegister(@RequestBody RegisterUserReqDTO registerUserReqDTO);

    /**
     * 根据 ID 查询用户信息
     *
     * @param findUserByIdReqDTO
     * @return
     */
    @PostMapping(value = PREFIX + "/findById")
    Response<FindUserByIdRspDTO> findById(@RequestBody @Validated FindUserByIdReqDTO findUserByIdReqDTO);

    /**
     * 批量根据 ID 查询用户
     *
     * @param findUsersByIdsReqDTO
     * @return
     */
    @PostMapping(value = PREFIX + "/findByIds")
    Response<List<FindUserByIdRspDTO>> findByIds(@RequestBody @Validated FindUsersByIdsReqDTO findUsersByIdsReqDTO);
}
